home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / LL_LAND.ZIP / LL_LAND.INC < prev    next >
Text File  |  1993-05-11  |  8KB  |  311 lines

  1. ;;
  2. ;; [ Lord Logics Lanscape File ]
  3. ;;
  4. .data
  5.     public  C       ll_table
  6.     ll_table        dw      offset table
  7.             dw      @data
  8.     table           dw      46*46*2 dup (0)
  9.  
  10. ;;
  11. ;; SIN Data : Values range from 32767 to -32768 with 360 intervals.
  12. ;;
  13.        SIN_L   dw      0,   571,  1143,  1714,  2285,  3425
  14.            dw   3425,  3993,  4560,  5125,  5689,  6812
  15.            dw   6812,  7370,  7927,  8480,  9031, 10125
  16.            dw  10125, 10667, 11206, 11742, 12274, 13327
  17.            dw  13327, 13847, 14364, 14875, 15383, 16383
  18.            dw  16383, 16876, 17363, 17846, 18323, 19259
  19.            dw  19259, 19719, 20173, 20620, 21062, 21925
  20.            dw  21925, 22347, 22761, 23169, 23570, 24350
  21.            dw  24350, 24729, 25100, 25464, 25820, 26509
  22.            dw  26509, 26841, 27165, 27480, 27787, 28377
  23.            dw  28377, 28658, 28931, 29195, 29450, 29934
  24.            dw  29934, 30162, 30381, 30590, 30790, 31163
  25.            dw  31163, 31335, 31497, 31650, 31793, 32050
  26.            dw  32050, 32164, 32269, 32363, 32448, 32587
  27.            dw  32587, 32642, 32687, 32722, 32747, 32767
  28.            dw  32767, 32762, 32747, 32722, 32687, 32587
  29.            dw  32587, 32522, 32448, 32363, 32269, 32050
  30.            dw  32050, 31927, 31793, 31650, 31497, 31163
  31.            dw  31163, 30981, 30790, 30590, 30381, 29934
  32.            dw  29934, 29696, 29450, 29195, 28931, 28377
  33.            dw  28377, 28086, 27787, 27480, 27165, 26509
  34.            dw  26509, 26168, 25820, 25464, 25100, 24350
  35.            dw  24350, 23964, 23570, 23169, 22761, 21925
  36.            dw  21925, 21497, 21062, 20620, 20173, 19259
  37.            dw  19259, 18794, 18323, 17846, 17363, 16383
  38.            dw  16383, 15885, 15383, 14875, 14364, 13327
  39.            dw  13327, 12803, 12274, 11742, 11206, 10125
  40.            dw  10125,  9580,  9031,  8480,  7927,  6812
  41.            dw   6812,  6252,  5689,  5125,  4560,  3425
  42.            dw   3425,  2855,  2285,  1714,  1143,     0
  43.            dw      0,  -571, -1143, -1714, -2285, -3425
  44.            dw  -3425, -3993, -4560, -5125, -5689, -6812
  45.            dw  -6812, -7370, -7927, -8480, -9031,-10125
  46.            dw -10125,-10667,-11206,-11742,-12274,-13327
  47.            dw -13327,-13847,-14364,-14875,-15383,-16383
  48.            dw -16383,-16876,-17363,-17846,-18323,-19259
  49.            dw -19259,-19719,-20173,-20620,-21062,-21925
  50.            dw -21925,-22347,-22761,-23169,-23570,-24350
  51.            dw -24350,-24729,-25100,-25464,-25820,-26509
  52.            dw -26509,-26841,-27165,-27480,-27787,-28377
  53.            dw -28377,-28658,-28931,-29195,-29450,-29934
  54.            dw -29934,-30162,-30381,-30590,-30790,-31163
  55.            dw -31163,-31335,-31497,-31650,-31793,-32050
  56.            dw -32050,-32164,-32269,-32363,-32448,-32587
  57.            dw -32587,-32642,-32687,-32722,-32747,-32767
  58.            dw -32767,-32762,-32747,-32722,-32687,-32587
  59.            dw -32587,-32522,-32448,-32363,-32269,-32050
  60.            dw -32050,-31927,-31793,-31650,-31497,-31163
  61.            dw -31163,-30981,-30790,-30590,-30381,-29934
  62.            dw -29934,-29696,-29450,-29195,-28931,-28377
  63.            dw -28377,-28086,-27787,-27480,-27165,-26509
  64.            dw -26509,-26168,-25820,-25464,-25100,-24350
  65.            dw -24350,-23964,-23570,-23169,-22761,-21925
  66.            dw -21925,-21497,-21062,-20620,-20173,-19259
  67.            dw -19259,-18794,-18323,-17846,-17363,-16383
  68.            dw -16383,-15885,-15383,-14875,-14364,-13327
  69.            dw -13327,-12803,-12274,-11742,-11206,-10125
  70.            dw -10125, -9580, -9031, -8480, -7927, -6812
  71.            dw  -6812, -6252, -5689, -5125, -4560, -3425
  72.            dw  -3425, -2855, -2285, -1714, -1143,     0
  73.  
  74.            ;; COS continuation . . .
  75.            dw      0,   571,  1143,  1714,  2285,  3425
  76.            dw   3425,  3993,  4560,  5125,  5689,  6812
  77.            dw   6812,  7370,  7927,  8480,  9031, 10125
  78.            dw  10125, 10667, 11206, 11742, 12274, 13327
  79.            dw  13327, 13847, 14364, 14875, 15383, 16383
  80.            dw  16383, 16876, 17363, 17846, 18323, 19259
  81.            dw  19259, 19719, 20173, 20620, 21062, 21925
  82.            dw  21925, 22347, 22761, 23169, 23570, 24350
  83.            dw  24350, 24729, 25100, 25464, 25820, 26509
  84.            dw  26509, 26841, 27165, 27480, 27787, 28377
  85.            dw  28377, 28658, 28931, 29195, 29450, 29934
  86.            dw  29934, 30162, 30381, 30590, 30790, 31163
  87.            dw  31163, 31335, 31497, 31650, 31793, 32050
  88.            dw  32050, 32164, 32269, 32363, 32448, 32587
  89.            dw  32587, 32642, 32687, 32722, 32747, 32767
  90.  
  91. .code
  92. land_clr        proc
  93. ; Routine
  94.     push    es
  95.     push    ds
  96.     push    di
  97.  
  98.     mov     ax,@data
  99.     mov     ds,ax
  100.  
  101.     mov     ax,0A000h
  102.     mov     di,LL_DRAW
  103.     mov     si,LL_BACK
  104.     mov     es,ax
  105.     mov     ds,ax
  106.  
  107.     ;;
  108.     ;; Set WRITE MODE #1
  109.     ;;
  110.     mov     dx,03ceh
  111.     mov     al,05h
  112.     out     dx,al
  113.     inc     dx
  114.     in      al,dx
  115.     or      al,00000001b
  116.     and     al,11111101b
  117.     out     dx,al
  118.  
  119.     ;;
  120.     ;; Enable ALL FOUR Planes
  121.     ;;
  122.     mov     dx,03C4h                ;; Enable ALL Planes
  123.     mov     al,02h                  ;; :
  124.     mov     ah,00001111b            ;; :
  125.     out     dx,ax                   ;; :
  126.  
  127.     mov     cx,64000/4              ;; Refresh Background
  128.     rep     movsb                   ;; :
  129.  
  130.     ;;
  131.     ;; Set WRITE MODE #0
  132.     ;;
  133.     mov     dx,03ceh
  134.     mov     al,05h
  135.     out     dx,al
  136.     inc     dx
  137.     in      al,dx
  138.     and     al,11111100b
  139.     out     dx,al
  140.  
  141.     pop     di
  142.     pop     ds
  143.     pop     es
  144.     ret
  145. land_clr        endp
  146.  
  147. land_put        proc
  148. ; Arguments
  149.     X1      equ     word ptr [bp+MM]
  150.     Y1      equ     word ptr [bp+MM+2]
  151.     Water   equ     word ptr [bp+MM+4]
  152.     Alpha   equ     word ptr [bp+MM+6]
  153.  
  154. ; Variables
  155.     X       equ     word ptr [bp-6]
  156.     Y       equ     word ptr [bp-8]
  157.     Y2      equ     word ptr [bp-10]
  158.     Dummy   equ     word ptr [bp-12]
  159.     DatSeg  equ     word ptr [bp-14]
  160.     Z_Count equ     word ptr [bp-16]
  161.  
  162. ; Constants
  163.     LandW   equ     46                      ;; Land Width
  164.     LandD   equ     46                      ;; Land Height
  165.     d       equ     250
  166.     CamX    equ     0
  167.     CamY    equ     200
  168.     CamZ    equ     750
  169.     MapW    equ     256-LandW
  170.  
  171. ; Routine
  172.     push    bp
  173.     mov     bp,sp
  174.     sub     sp,20
  175.     push    ds
  176.     push    es
  177.  
  178.     mov     si,seg LL_DATA
  179.     mov     ds,si
  180.     mov     si,offset LL_DATA
  181.  
  182.     mov     dx,0A000h
  183.     mov     es,dx
  184.     mov     ax,Y1
  185.     mov     bx,MapW+LandW
  186.     mul     bx
  187.     add     ax,X1
  188.     add     si,ax
  189.  
  190.     mov     di,offset table
  191.  
  192.     mov     dx,LandD
  193.     mov     Z_Count,dx
  194.  
  195. lp_1:   mov     cx,LandW
  196. lp_2:   mov     Dummy,cx
  197.     xor     ah,ah
  198.     mov     al,[si]
  199.     cmp     ax,Water
  200.     jge     @F
  201.     mov     ax,Water
  202. @@:     sub     ax,Water
  203.     inc     ax
  204.     mov     Y,ax
  205.  
  206.     mov     DatSeg,ds
  207.  
  208.     mov     cx,@data
  209.     mov     ds,cx
  210.  
  211.     mov     cx,[di]                 ;; Radius
  212.     mov     bx,[di+2]               ;; Theta
  213.     add     bx,Alpha                ;; Theta+=Alpha
  214. @@:     cmp     bx,360
  215.     jl      @F
  216.     sub     bx,360
  217.     jmp     @B
  218. @@:     cmp     bx,0
  219.     jge     @F
  220.     add     bx,360
  221.     jmp     @B
  222. @@:     shl     bx,1
  223.     add     bx,offset SIN_L
  224.     mov     ax,[bx]
  225.     add     bx,180
  226.     mov     bx,[bx]
  227.     imul    cx                      ;; x = r*sin(theta)
  228.     mov     X,dx                    ;; :
  229.     mov     ax,bx                   ;; :
  230.     imul    cx                      ;; z = r*cos(theta)
  231.     mov     bx,dx                   ;; :
  232.     add     di,4                    ;; Increment to next table pos
  233.     mov     ds,DatSeg
  234.  
  235.     add     bx,CamZ
  236.     add     bx,d
  237.  
  238.     cmp     bx,20
  239.     jle     lp_skp
  240.     mov     cx,d
  241.  
  242.     mov     ax,Y
  243.     sub     ax,CamY
  244.     imul    cx
  245.     idiv    bx
  246.     neg     ax
  247.     add     ax,100
  248.     cmp     ax,0
  249.     jl      lp_skp
  250.     cmp     ax,200
  251.     jge     lp_skp
  252.     mov     Y2,ax
  253.  
  254.     mov     ax,X
  255.     add     ax,CamX
  256.     imul    cx
  257.     idiv    bx
  258.     add     ax,160
  259.     cmp     ax,0
  260.     jl      lp_skp
  261.     cmp     ax,320
  262.     jge     lp_skp
  263.     mov     cx,ax                   ;; X Pos
  264.  
  265.     ;;
  266.     ;; Put up the dot
  267.     ;;
  268.     mov     ax,Y2                   ;; Get Y Pos
  269.     mov     bx,(LL_HOR/4)
  270.     mul     bx
  271.     mov     bx,ax
  272.  
  273.     mov     ax,cx                   ;; Get X Pos
  274.     mov     cl,al
  275.     and     cl,00000011b
  276.     mov     dl,00000001b
  277.     shl     dl,cl
  278.     mov     cl,dl
  279.     shr     ax,1
  280.     shr     ax,1
  281.     add     bx,ax
  282.  
  283.     mov     dx,03C4h                ;; Enable Plane
  284.     mov     al,02h                  ;; :
  285.     mov     ah,cl                   ;; :
  286.     out     dx,ax                   ;; :
  287.     mov     ax,Y                    ;; Get color
  288.  
  289.     mov     dx,@data
  290.     mov     ds,dx
  291.     add     bx,LL_DRAW
  292.     mov     es:[bx],al
  293.     mov     ds,DatSeg
  294.  
  295. lp_skp: mov     cx,Dummy
  296.  
  297.     inc     si
  298.     dec     cx
  299.     jnz     lp_2
  300.     add     si,(MapW)
  301.     dec     Z_Count
  302.     jnz     lp_1
  303.  
  304.     pop     es
  305.     pop     ds
  306.     mov     sp,bp
  307.     pop     bp
  308.     ret
  309. land_put        endp
  310.  
  311.